{include file="header.html"}
<div id="main">
	{include file="menus.html"}
	<div id="rightCon" class="clearfix layui-body">
		<div class="scroller">
			<div class="tablegrid">
				<table class="layui-hide" id="tablegrid" lay-filter="tablegrid"></table>
			</div>
			{include file="version.html"}
		</div>
	</div>
</div>
<script type="text/html" id="toolbar">
	<div class="layui-btn-container">
	  <a class="layui-btn layui-bg-blue" href="{url route='store/index'}"><i class="layui-icon layui-icon-return"></i>返回店铺列表</a>
	</div>
</script>

<script type="text/html" id="colBar">
	<a class="ml5 mr5 blue pointer" lay-event="agree">通过</a>
	<a class="ml5 mr5 blue pointer" lay-event="view">拒绝</a>
	<a class="ml5 mr5 blue pointer" lay-event="view">查看</a>
</script>

<script>
	layui.use('table', function () {
		var table = layui.table;

		table.render({
			elem: '#tablegrid'
			//,skin: 'line'
			, url: url(['store/verify', $("#formSearch").serializeJson()])
			, toolbar: '#toolbar'
			, defaultToolbar: ['filter', /*'exports',*/ 'print']
			, title: '店铺审核'
			//, size: 'lg'
			, cols: [[
				{ type: 'checkbox', fixed: 'left' }
				, { field: 'store_id', title: 'ID', width: 70, fixed: 'left', unresize: true, sort: true }
				, { field: 'username', title: '用户名', width: 100 }
				, { field: 'owner_name', title: '店主', width: 100 }
				, { field: 'store_name', title: '店铺名', width: 200 }
				, { field: 'stype', title: '主体类型', width: 120, align: 'center' }
				, { field: 'sgrade', title: '店铺等级', width: 160 }
				, { field: 'region_name', title: '所在地区', width: 260 }
				, { fixed: 'right', title: '操作', toolbar: '#colBar', width: 200, align: 'center' }
			]]
			, page: {
				theme: 'blue'
			}
		});

		//监听行工具事件
		table.on('tool(tablegrid)', function (obj) {
			var data = obj.data;
			if (obj.event == 'agree') {
				layer.confirm('点击“确认”按钮后，该店铺将正式开通', { title: lang.store_verify }, function (index) {
					var formObj = $('<form><input name="action" value="agree"><form>');
					ajaxSubmit('post', url(['store/view', { id: data.store_id }]), formObj);
					layer.close(index);
				}, function (index) {
					layer.close(index);
				});
			}
			else if (obj.event === 'view') {
				window.location.href = url(['store/view', { id: data.store_id }]);
			}
		});
	});
</script>
{include file="footer.html"}